<!doctype html>
<head>
    <meta charset="utf-8">
	<title>CJH之指导思想与实践计划宪章</title>
  <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
  <script src="https://cdn.bootcss.com/showdown/1.3.0/showdown.min.js"></script>
  <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"
   <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script src="https://cdn.bootcss.com/twitter-bootstrap/3.2.0/js/collapse.min.js"></script>
  <script src="https://cdn.bootcss.com/twitter-bootstrap/3.2.0/js/dropdown.min.js"></script>
 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
 <meta name=renderer  content=webkit>
	 <!--base target="_blank"-->
  <style type="text/css">
	  :target{
margin-top:60px;
}
        body{
            margin-top: 60px;
		margin-bottom: 20px;
        }
    </style>
</head>
<body>

<!-- 导航栏 -->
	<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container-fluid"> 
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse"
                data-target="#example-navbar-collapse">
            <span class="sr-only">切换导航</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="#">CJH之指导思想与实践计划宪章</a>
    </div>
    <div class="collapse navbar-collapse" id="example-navbar-collapse">
        <ul class="nav navbar-nav">
            
            <li id="qzone" class="active">
                <a href="http://1921806464.qzone.qq.com/" >
                    站长空间
                </a>
            </li>
			<li id="donate" class="active">
			    <a href="https://cjh0613.github.io" >
			        支持站长
			    </a>
			</li>
			
        </ul>
    </div>
    </div>
</nav>

<p> 123</p>
 <script>
 $.get("https://cjh0613.github.io/doc/指导思想与实践计划宪章.md",function(data,status){
   //alert("数据: " + data + "\n状态: " + status);
           var converter = new showdown.Converter();
           //var text      = '#hello, markdown!',
           html      = converter.makeHtml(data);
           
           $(html).insertBefore("p");
		   
		   
		   
		   /*var content = 'a';
		   var num1=$("h2").size();
		   $("li").size();
		   for(var i =0;i<3;i++)
		   {
		       
		   	content += num1;
		   }
		   content    += '</a>';
		   content    += '</li>';
		   
		   
		   $('#qzone').prepend(content);
		   */
		  var jquery_h3_list = $('h2');//如果你的章节标题不是h3,只需要将这里的h3换掉即可
    if(jquery_h3_list.length>0)
    {
        var content = '';
        //content    += '<ul style="list-style-type:none;text-align: left;margin:2px 2px;">';
        for(var i =0;i<jquery_h3_list.length;i++)
        {
            //var go_to_top = '<div style="text-align: right"><a name="_lab' + i + '"></a></div>';
			var go_to_top = '<a name="_lab' + i + '"></a>';
            $(jquery_h3_list[i]).before(go_to_top);
            var jquery_h4_list = $(jquery_h3_list[i]).nextUntil(jquery_h3_list[i+1], "h3");
            if(jquery_h4_list.length>0)
            {
                var li_content = '<li class="dropdown"><a href="#_lab' + i + '" class="dropdown-toggle" data-toggle="dropdown">' + $(jquery_h3_list[i]).text() + '<b class="caret"></b></a>';
                //var jquery_h4_list = $(jquery_h3_list[i]).nextUntil(jquery_h3_list[i+1], "h3");
				li_content +='<ul class="dropdown-menu">';
            }
			else{
				var li_content = '<li class="dropdown"><a href="#_lab' + i + '" >' + $(jquery_h3_list[i]).text() + '</a>';
            //var jquery_h4_list = $(jquery_h3_list[i]).nextUntil(jquery_h3_list[i+1], "h3");
			}
            for(var j = 0;j < jquery_h4_list.length;j++)
            {
                //var go_to_top2 = '<div style="text-align: right"><a name="_lab2'+ i + j + '"></a></div>';
				var go_to_top2 = '<a name="_lab2'+ i + j + '"></a>';
                $(jquery_h4_list[j]).before(go_to_top2);
                li_content +='<li><a href="#_lab2'+ i + j + '">' + $(jquery_h4_list[j]).text() + '</a></li>';
            }
            if(jquery_h4_list.length>0)
            {
                li_content +='</ul>';
            }
            li_content +='</li>';
            content += li_content;
        }
        //content    += '</ul>';
        //content    += '</div>';
       $('#qzone').before(content);
	   $("blockquote > a").attr("style","display:block;height:44px;margin-top:-44px;");
	   //$("ul[style$='dropdown-menu']:parent a:first-child").attr("class"."dropdown-toggle");
		//data-toggle="dropdown"
    }    
		  
		  
 });
 /*$("a").click(function(){
    // 动作触发后执行的代码!!
	$("#example-navbar-collapse").attr("class","navbar-collapse collapse");
});*/
 </script>
</body>
</html>
